
#ifndef WISHMASTER_TASKREQUESTBOARD_H
#define WISHMASTER_TASKREQUESTBOARD_H

#include <QObject>
#include <QUrl>
#include "components/postid.h"
#include "components/threadid.h"
#include "task.h"
#include "network/request.h"
#include "network/connector.h"
#include "misc.h"

namespace Wishmaster
{
	class WISHMASTER_EXPORT TaskRequest: public Task
	{
		Q_OBJECT
	public:
		enum RequestType
		{
			rtUnknown = 0,
			rtBoard,
			rtThread,
			rtPost,
			rtAttachment
		};
		TaskRequest(RequestType type, const QUrl& link, const QString& msg, Connector* connector);
		virtual ~TaskRequest();

		RequestType requestType() const;
		QUrl link() const;

		virtual void start();
		virtual void cancel();

	protected slots:
		virtual void slot_result(const RequestPtr& request, const QByteArray& arr);
		void slot_progress(int done, int total);

	private:
		RequestType m_type;
		RequestPtr m_request;
		PostId m_postId;
		int m_attachmentIndex;
		QUrl m_link;
		Connector* m_connector;
	};
}

#endif

